//
//  LXHomeViewController.m
//  LXLessDemo
//
//  Created by LX on 16/2/15.
//  Copyright © 2016年 LX. All rights reserved.
//

#import "LXHomeViewController.h"
#import "LXHomeViewCell.h"

@interface LXHomeViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (strong, nonatomic) IBOutlet UITableView *mainTable;

@end

@implementation LXHomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = backColor;
    self.mainTable.delegate = self;
    self.mainTable.dataSource = self;
    self.title = @"热门用户";
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 2;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 1;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 10;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 448;
}

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    return nil;
}
-(void)viewDidDisappear:(BOOL)animated{
    [super viewDidDisappear:animated];
    [[NSNotificationCenter defaultCenter] postNotificationName:@"CLOSE_HOME" object:nil];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *HomeViewCellCellIndentfer = @"OfficialActivitiesCellIndentfer";
    LXHomeViewCell *HomeViewCellCell = [tableView dequeueReusableCellWithIdentifier:HomeViewCellCellIndentfer];
    if (!HomeViewCellCell) {
        HomeViewCellCell = [[[NSBundle mainBundle] loadNibNamed:@"LXHomeViewCell" owner:self options:nil] objectAtIndex:0] ;
    }

    if (indexPath.section == 0) {
        [HomeViewCellCell settingMainImageView:[UIImage imageNamed:@"4"] titleLab:@"开心小猫，卖萌，只要998" user:[UIImage imageNamed:@"homenew_touxiang"] nameLab:@"高富帅" date:@"不久前"];

    }
    return HomeViewCellCell;

//    static NSString *cellIndentfer = @"ccelldengng";
//    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIndentfer];
//    if (!cell) {
//        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIndentfer];
//    }
//    cell.textLabel.text = @"tset";
//    cell.textLabel.textColor = [UIColor redColor];
//    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
